import { LoginAction } from '@/types/store'
import { token } from '@/types/data'
import { getToken } from '@/utils/storage'
const initialState: token = getToken()
const login = (state = initialState, action: LoginAction) => {
  if (action.type === 'login/Token') {
    return action.payload
  } else if (action.type === 'login/logout') {
    return initialState
  }
  return state
}

export default login
